import request from '@/utils/request'
import type { ResultList } from '@/@types/index.type'

export interface User {
  userId?: number
  username: string
  nickName?: string
  password?: string
  email?: string
  status: string
  roleIds?: number[]
}

export const addUser = (data: any) => request.post('/system/user', data)

export const getUser = (id: number) => request.get<any>('/system/user/' + id)

export const deleteUser = (id: number) => request.delete('/system/user/' + id)

export const updateUser = (id: number, data: any) => request.put('/system/user/' + id, data)

export const getUserList = (data: any) => request.get<ResultList<User>>('/system/user', data)

export const getAllUser = () => request.get<User[]>('/system/user/all')
